/*
		ServEngine framework library
		A library to fast develop JEE online applications
	
		Copyright 2008 José Ignacio de Córdoba Álvaro

		Licensed under the Apache License, Version 2.0 (the "License");
		you may not use this file except in compliance with the License.
		You may obtain a copy of the License at

				http://www.apache.org/licenses/LICENSE-2.0

		Unless required by applicable law or agreed to in writing, software
		distributed under the License is distributed on an "AS IS" BASIS,
		WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
		See the License for the specific language governing permissions and
		limitations under the License.
	
		Jose Ignacio de Cordoba Alvaro
		http://ignacio.decordoba.com
*/

package com.servengine.portal;

import com.servengine.user.Role;

import java.util.List;
import java.util.Set;

import javax.ejb.Local;

import javax.mail.internet.InternetAddress;

/**
 * This session EJB encapsulates all business logic related to portal management.
 * @see PortalManagerBean
 */
@Local
public interface PortalManagerLocal
{
	public Portal getPortal(String portalid);

	public Portal getPortalByHomeURL(String homeurl);
	//	public Collection<Category> getAllCategories();

	public Portal persist(Portal portal);

	public void checkPortal(String portalid, String locale, boolean addAllActionsIfNew);
	//	public List<Category> getRootCategories();
	//	public void syncActionsInClientClassPath(Set<Component> actions);
	//	public Component getAction(String className, boolean guest, boolean admin);

	public Component getAction(String className);

	public void persist(Component action);

	public InternetAddress[] getAdminEmails(String portalid);

	public InternetAddress getEmail(String portalid);

	public Set<Component> getActionsForServiceName(String servicename);
	public void updateRoleAdminServiceActions(Role role);
	public void updateRoleServiceActions(Role role);

	public void portalAccessed(String portalid);

	public Portal setProperty(String portalid, String propertyid, String value);

	public Portal removeProperty(String portalid, String propertyname);

	public void removeExtraUserdataFields(String portalid, Integer[] fieldIds);

	public List<String> getSystemServiceNames();

	public Set<String> getNonSystemServiceNames();

	public Set<Component> getActionsByRoleId(String portalid, Integer id);

	public void setActionRoles(String portalid, String className, Integer[] roleIds);

	public Integer[] getActionRoleIdsForPortal(Portal portal, Component action);

	public Set<Portal> getPortalsWithPropertyName(String propertyName);

	public Set<Portal> getPortalsWithProperty(String propertyName, String propertyValue);

	public boolean exists(String portalid);

	public void createPortal(java.lang.String portalid, String homeurl, java.lang.String description, String locale, String adminuserid, String adminpassword, String adminemail, String adminfirstname, String adminlastname, String adminlastname2);

	//	  public Map<String,User> getGuestUsers();

	public List<Component> getAllActions();
	public long getPortalCount();
}
